﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace OneMake.Winforms
{
    public partial class FormInput : Form
    {
        public FormInput(string tip)
        {
            InitializeComponent();
            TipLabel.Text = tip;
        }

        private string returnValue;
        public string Value
        {
            set { returnValue = value; }
            get { return returnValue; }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            returnValue = null;
            DialogResult = DialogResult.Cancel;
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            returnValue = txtInput.Text;
            DialogResult = DialogResult.OK;
        }

        private void txtInput_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                btnOk_Click(sender, e);
            }
        }
    }
}
